home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung (Tewi)(1994).iso
/
magazine
/
dbms_mag
/
9107
/
techtip1
< prev
next >
Wrap
Text File
|
1991-05-21
|
2KB
|
59 lines
LISTING 1
* In an Order Entry Program, a user wants to be able to add
* a new Sales Order Number that increments by 10. If for any
* reason the complete order cannot be shipped together, then
* the number is to be incremented by 1. This allows for nine
* partial shipments from the original Sales order.
*
* The program example computes the next Partial Shipment order
* number given the present order number.
*
* Author: Ronald K. Pickett
*
************** Example Sales Order Database *********************
* Record SO_NUM Record SO_NUM Record SO_NUM
* 1 10 6 32 11 37
* 2 20 7 33 12 38
* 3 21 8 34 13 39
* 4 30 9 35 14 40
* 5 31 10 36 EOF
*
USE SALES
INDEX ON SO_NUM TO SALES
STORE SO_NUM TO mSO_NUM
CLEAR
@ 12,12 SAY 'ENTER SALES ORDER NUMBER' GET mSO_NUM
READ && Program will find the next available from
SEEK mSO_NUM && the record pointer.
IF MOD(mSO_NUM,10)=0 && Adjusts record pointer to allow for partial
SKIP && sales orders (order #'s ending in 1 to 9)
IF !EOF() && to be checked.
STORE SO_NUM TO mSO_NUM && Store the 'skipped' Sales order # for
ENDIF && further testing.
ENDIF
DO WHILE MOD(mSO_NUM,10)>0 .AND. !EOF() .AND. MOD(mSO_NUM,10)<9
SKIP && Locate the last Partial Order #.
STORE SO_NUM TO mSO_NUM
ENDDO
DO CASE
CASE MOD(mSO_NUM,10)=9
@ 24,10 SAY 'This is the Last Partial Shipment for this Sales Order '
WAIT ''
CASE EOF()
SKIP -1
STORE SO_NUM TO mSO_NUM
mSO_NUM=mSO_NUM+1
CASE MOD(mSO_NUM,10)=0 && Checks for two successive records
SKIP -1 && (Sales orders) ending in zero.
STORE SO_NUM TO mSO_NUM
mSO_NUM=mSO_NUM+1
OTHERWISE
mSO_NUM=mSO_NUM+1
ENDCASE
@ 13,12 SAY 'NEW SALES # = '+STR(INT(mSO_NUM))
WAIT
CLOSE DATA
QUIT